Skip to content

Move from httpretty to mocket as http mocking library#4583

Merged
xrmx merged 8 commits into
open-telemetry:mainfrom
xrmx:move-to-mocket
May 15, 2026
Merged

Move from httpretty to mocket as http mocking library#4583
xrmx merged 8 commits into
open-telemetry:mainfrom
xrmx:move-to-mocket

Conversation

@xrmx
Copy link
Copy Markdown
Contributor

@xrmx xrmx commented May 14, 2026

Description

Move urllib, urllib3 and requests instrumentation http mock library from abandoned httpretty to mocket. I've tried to use their httpretty shim layer first but it's incomplete and adding the missing part would need to implement a different API that the httpretty original one. This let us run urllib3 tests on Python 3.14.

Fixes #4200
Closes #4318
Closes #4282

Assisted-by: Cursor

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@xrmx xrmx requested a review from a team as a code owner May 14, 2026 09:41
@xrmx xrmx moved this to Ready for review in Python PR digest May 14, 2026
@xrmx xrmx changed the title Move to mocket Move from httpretty to mocket as http mocking library May 14, 2026
@xrmx xrmx force-pushed the move-to-mocket branch from 90483af to 0343d57 Compare May 14, 2026 09:45
@xrmx xrmx mentioned this pull request May 14, 2026
11 tasks
@github-project-automation github-project-automation Bot moved this from Ready for review to Approved PRs in Python PR digest May 14, 2026
@emdneto
Copy link
Copy Markdown
Member

emdneto commented May 14, 2026

It seems it just works? and doesn't require any fix on the lib side like pook, so I'm good.

@xrmx
Copy link
Copy Markdown
Contributor Author

xrmx commented May 14, 2026

It seems it just works? and doesn't require any fix on the lib side like pook, so I'm good.

Yeah, using the shim would have been a 20 lines diff but switching to use plain mocket was not that bad.

@xrmx xrmx enabled auto-merge (squash) May 15, 2026 07:37
@xrmx xrmx moved this from Approved PRs to Ready for merge in Python PR digest May 15, 2026
@github-project-automation github-project-automation Bot moved this from Ready for merge to Approved PRs in Python PR digest May 15, 2026
@xrmx xrmx merged commit 840d4bd into open-telemetry:main May 15, 2026
753 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Replace httpretty in tests

3 participants